#!/bin/bash

# add from 2019/09/26 begin

echo "127.0.0.1 upload.anjian.iyumweb.com" >> /etc/hosts
echo "127.0.0.1 transcode.anjian.iyumweb.com" >> /etc/hosts

# add from 2019/09/26 end

echo "starting nginx ..."

/usr/sbin/nginx -c /etc/nginx/nginx.conf

sleep 1

echo "starting redis ..."

nohup /usr/bin/redis-server /etc/redis.conf &

sleep 1

echo "starting mongod ..."

/usr/bin/mkdir -p /var/run/mongodb
/usr/bin/chown mongod:mongod /var/run/mongodb
/usr/bin/chmod 0755 /var/run/mongodb

/usr/bin/mongod -f /etc/mongod.conf

sleep 1

echo "starting php-fpm ..."

nohup /usr/sbin/php-fpm &

sleep 1

echo "starting mysqld_safe ..."

/usr/bin/mkdir -p /var/run/mysqld/
/usr/bin/chown mysql:mysql /var/run/mysqld
/usr/bin/chmod 0755 /var/run/mysqld

nohup /usr/bin/mysqld_safe --basedir=/usr & 

# add from 2019/09/26 begin

sleep 1

echo "start supervisor ..."

/usr/bin/supervisord -c /etc/supervisord.conf

# add from 2019/09/26 end

tail -f /dev/null

